home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / CCDBMS.ZIP / THREAD.H < prev   
C/C++ Source or Header  |  1997-03-18  |  1KB  |  50 lines

  1. // =================================================================
  2. // Thread.h
  3. // =================================================================
  4. // Harold Kasperink / John Dekker 
  5. // Dr. Dobb's Journal 1997
  6. // =================================================================
  7. // Thread class 
  8. // =================================================================
  9. #ifndef _THREAD_H_
  10. #define _THREAD_H_
  11.  
  12. // Fake thread library
  13. typedef int pthread_t;
  14.  
  15. #ifdef _WIN32
  16. #include <afxwin.h>
  17. #include <winbase.h>
  18. #endif
  19.  
  20. #ifndef boolean
  21. #define boolean BOOL
  22. #endif
  23. #define FALSE    0
  24. #define TRUE    1
  25.  
  26. class CThread;
  27. void ThreadFunc(CThread *);
  28.  
  29. ////////////////////////////////////////////////////////////////////
  30. // CNutex
  31. ////////////////////////////////////////////////////////////////////
  32. class CThread 
  33. {
  34. public:
  35.         CThread();
  36.         virtual ~CThread();
  37.  
  38.         void    Create();
  39.         void    Cancel();
  40.         void    Detach();
  41.         void    Join();
  42.  
  43.         friend  void    ThreadFunc(CThread *);
  44.         virtual void    Process(void) = 0;
  45. private:
  46.         pthread_t       m_Thread;
  47. };
  48.  
  49. #endif
  50.